import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Tab2 extends StatefulWidget {
  Tab2({Key key}) : super(key: key);

  _Tab2State createState() => _Tab2State();
}

class _Tab2State extends State<Tab2> {
  String sub = "";
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Material(
        child: Scaffold(
          appBar: AppBar(
            title: Text('路由管理'),
          ),
          body: ListView(
            children: <Widget>[
              ListTile(
                title: Text('我是page1页面$sub'),
                onTap: () {
                  Navigator.of(context)
                      .pushNamed('/page2', arguments: 'parent')
                      .then((value) {
                    print('aaaaaa......,$value');
                    setState(() {
                      sub = value;
                    });
                  });
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
